//
//	ZcoModelUser.m
//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport



#import "ZcoModelUser.h"

NSString *const kZcoModelUserIdField = @"_id";
NSString *const kZcoModelUserAgentId = @"agentId";
NSString *const kZcoModelUserCustomerLevel = @"customerLevel";
NSString *const kZcoModelUserIsDisabled = @"isDisabled";
NSString *const kZcoModelUserIsRobot = @"isRobot";
NSString *const kZcoModelUserName = @"name";
NSString *const kZcoModelUserOrg = @"org";
NSString *const kZcoModelUserProfile = @"profile";
NSString *const kZcoModelUserRole = @"role";
NSString *const kZcoModelUserSchedulingAttributes = @"schedulingAttributes";
NSString *const kZcoModelUserUserName = @"userName";
NSString *const kZcoModelUserUserAvatar = @"avatar";

@interface ZcoModelUser ()
@end
@implementation ZcoModelUser




/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
	self = [super init];
	if(![dictionary[kZcoModelUserIdField] isKindOfClass:[NSNull class]]){
		self.idField = [dictionary[kZcoModelUserIdField] integerValue];
	}
    
    if(![dictionary[kZcoModelUserAgentId] isKindOfClass:[NSNull class]]){
        self.agentId = [dictionary[kZcoModelUserAgentId] integerValue];
    }

	if(![dictionary[kZcoModelUserCustomerLevel] isKindOfClass:[NSNull class]]){
		self.customerLevel = [dictionary[kZcoModelUserCustomerLevel] integerValue];
	}

	if(![dictionary[kZcoModelUserIsDisabled] isKindOfClass:[NSNull class]]){
		self.isDisabled = dictionary[kZcoModelUserIsDisabled];
	}	
	if(![dictionary[kZcoModelUserIsRobot] isKindOfClass:[NSNull class]]){
		self.isRobot = [dictionary[kZcoModelUserIsRobot] boolValue];
	}

	if(![dictionary[kZcoModelUserName] isKindOfClass:[NSNull class]]){
		self.name = dictionary[kZcoModelUserName];
	}	
	if(![dictionary[kZcoModelUserOrg] isKindOfClass:[NSNull class]]){
		self.org = dictionary[kZcoModelUserOrg];
	}	
	if(![dictionary[kZcoModelUserProfile] isKindOfClass:[NSNull class]]){
		self.profile = [[ZcoModelProfile alloc] initWithDictionary:dictionary[kZcoModelUserProfile]];
	}

	if(![dictionary[kZcoModelUserRole] isKindOfClass:[NSNull class]]){
		self.role = dictionary[kZcoModelUserRole];
	}	
	if(![dictionary[kZcoModelUserSchedulingAttributes] isKindOfClass:[NSNull class]]){
		self.schedulingAttributes = [[ZcoModelSchedulingAttribute alloc] initWithDictionary:dictionary[kZcoModelUserSchedulingAttributes]];
	}

	if(![dictionary[kZcoModelUserUserName] isKindOfClass:[NSNull class]]){
		self.userName = dictionary[kZcoModelUserUserName];
	}
    if(![dictionary[kZcoModelUserUserAvatar] isKindOfClass:[NSNull class]]){
        self.avatar = dictionary[kZcoModelUserUserAvatar];
    }
	return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
	NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
	dictionary[kZcoModelUserIdField] = @(self.idField);
    dictionary[kZcoModelUserAgentId] = @(self.agentId);
	dictionary[kZcoModelUserCustomerLevel] = @(self.customerLevel);
	if(self.isDisabled != nil){
		dictionary[kZcoModelUserIsDisabled] = self.isDisabled;
	}
	dictionary[kZcoModelUserIsRobot] = @(self.isRobot);
	if(self.name != nil){
		dictionary[kZcoModelUserName] = self.name;
	}
	if(self.org != nil){
		dictionary[kZcoModelUserOrg] = self.org;
	}
	if(self.profile != nil){
		dictionary[kZcoModelUserProfile] = [self.profile toDictionary];
	}
	if(self.role != nil){
		dictionary[kZcoModelUserRole] = self.role;
	}
	if(self.schedulingAttributes != nil){
		dictionary[kZcoModelUserSchedulingAttributes] = [self.schedulingAttributes toDictionary];
	}
	if(self.userName != nil){
		dictionary[kZcoModelUserUserName] = self.userName;
	}
    if(self.avatar != nil){
        dictionary[kZcoModelUserUserAvatar] = self.avatar;
    }
	return dictionary;

}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
	[aCoder encodeObject:@(self.idField) forKey:kZcoModelUserIdField];
    [aCoder encodeObject:@(self.customerLevel) forKey:kZcoModelUserCustomerLevel];	if(self.isDisabled != nil){
		[aCoder encodeObject:self.isDisabled forKey:kZcoModelUserIsDisabled];
	}
    [aCoder encodeObject:@(self.agentId) forKey:kZcoModelUserAgentId];
	[aCoder encodeObject:@(self.isRobot) forKey:kZcoModelUserIsRobot];	if(self.name != nil){
		[aCoder encodeObject:self.name forKey:kZcoModelUserName];
	}
	if(self.org != nil){
		[aCoder encodeObject:self.org forKey:kZcoModelUserOrg];
	}
	if(self.profile != nil){
		[aCoder encodeObject:self.profile forKey:kZcoModelUserProfile];
	}
	if(self.role != nil){
		[aCoder encodeObject:self.role forKey:kZcoModelUserRole];
	}
	if(self.schedulingAttributes != nil){
		[aCoder encodeObject:self.schedulingAttributes forKey:kZcoModelUserSchedulingAttributes];
	}
	if(self.userName != nil){
		[aCoder encodeObject:self.userName forKey:kZcoModelUserUserName];
	}
    if(self.avatar != nil){
        [aCoder encodeObject:self.avatar forKey:kZcoModelUserUserAvatar];
    }

}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
	self = [super init];
	self.idField = [[aDecoder decodeObjectForKey:kZcoModelUserIdField] integerValue];
    self.agentId = [[aDecoder decodeObjectForKey:kZcoModelUserAgentId] integerValue];
	self.customerLevel = [[aDecoder decodeObjectForKey:kZcoModelUserCustomerLevel] integerValue];
	self.isDisabled = [aDecoder decodeObjectForKey:kZcoModelUserIsDisabled];
	self.isRobot = [[aDecoder decodeObjectForKey:kZcoModelUserIsRobot] boolValue];
	self.name = [aDecoder decodeObjectForKey:kZcoModelUserName];
	self.org = [aDecoder decodeObjectForKey:kZcoModelUserOrg];
	self.profile = [aDecoder decodeObjectForKey:kZcoModelUserProfile];
	self.role = [aDecoder decodeObjectForKey:kZcoModelUserRole];
	self.schedulingAttributes = [aDecoder decodeObjectForKey:kZcoModelUserSchedulingAttributes];
	self.userName = [aDecoder decodeObjectForKey:kZcoModelUserUserName];
    self.avatar = [aDecoder decodeObjectForKey:kZcoModelUserUserAvatar];
	return self;

}

/**
 * Implementation of NSCopying copyWithZone: method
 */
- (instancetype)copyWithZone:(NSZone *)zone
{
	ZcoModelUser *copy = [ZcoModelUser new];

	copy.idField = self.idField;
    copy.agentId = self.agentId;
	copy.customerLevel = self.customerLevel;
	copy.isDisabled = [self.isDisabled copy];
	copy.isRobot = self.isRobot;
	copy.name = [self.name copy];
	copy.org = [self.org copy];
	copy.profile = [self.profile copy];
	copy.role = [self.role copy];
	copy.schedulingAttributes = [self.schedulingAttributes copy];
	copy.userName = [self.userName copy];
    copy.avatar = [self.avatar copy];

	return copy;
}

@end
